<template>
  <div>
    <div @click="$router.push('/postDatail/'  + postData.id)">
      <div class="singleImg" v-if="postData.type == 1 && postData.cover.length < 3">
        <div class="left">
          <div class="title">{{postData.title}}</div>
          <div class="info">{{postData.user.nickname}} {{postData.comment_length}}跟帖</div>
        </div>
        <img :src="postData.cover[0].url" alt class="right" />
      </div>

      <div class="multiImg" v-if="postData.type == 1 && postData.cover.length >=3">
        <div class="title">{{postData.title}}</div>
        <div class="imgs">
          <img :src="postData.cover[0].url" alt />
          <img :src="postData.cover[1].url" alt />
          <img :src="postData.cover[2].url" alt />
        </div>
        <div class="info">{{postData.user.nickname}} {{postData.comment_length}}跟帖</div>
      </div>

      <div class="video" v-if="postData.type == 2">
        <div class="title">{{postData.title}}</div>
        <div class="coverWrapper">
          <img :src="postData.cover[0].url" alt />
          <div class="iconfont iconshipin"></div>
        </div>
        <div class="info">{{postData.user.nickname}} {{postData.comment_length}}跟帖</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["postData"]
};
</script>

<style lang="less" scoped>
.A-single-picture {
  width: 100%;
  height: 79.99px;
  display: flex;
  padding-left: 5px;
  border-bottom: 1px solid #ccc;
  .text {
    position: relative;
    margin-top: 10px;
    flex: 2;
    .userinfo {
      position: absolute;
      bottom: 10px;
      display: flex;
      font-size: 14px;
    }
  }
  .img {
    width: 120px;
    object-fit: cover;
    height: 70px;
    // overflow: hidden;
    img {
      width: 100%;
      height: 100px;
    }
  }
}
.singleImg {
  display: flex;
  padding: 4.44vw 2.78vw;
  border-bottom: 1px solid #e4e4e4;
  .left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    .title {
      font-size: 4.44vw;
    }
    .info {
      font-size: 3.89vw;
      color: #888;
    }
  }
  .right {
    width: 33.33vw;
    height: 20.56vw;
    object-fit: cover;
  }
}

.multiImg {
  padding: 4.44vw 2.78vw;
  border-bottom: 0.28vw solid #e4e4e4;
  .title {
    font-size: 4.44vw;
  }
  .imgs {
    display: flex;
    justify-content: space-between;
    padding: 1.11vw 0 2.22vw;
    img {
      width: 33%;
      height: 74px;
    }
  }
  .info {
    font-size: 3.89vw;
    color: #888;
  }
}

.video {
  padding: 4.444vw 2.778vw;
  border-bottom: 1px solid #e4e4e4;
  .title {
    font-size: 4.444vw;
  }
  .coverWrapper {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    padding: 1.111vw 0 2.222vw;
    img {
      width: 100%;
      height: 47.222vw;
      object-fit: cover;
    }
    .iconshipin {
      position: absolute;
      font-size: 12.778vw;
      height: 12.778vw;
      line-height: 12.778vw;
      text-align: center;
      background: #aaa;
      color: white;
      border-radius: 50%;
    }
  }
  .info {
    font-size: 3.889vw;
    color: #888;
  }
}
</style>